package hadoopLearn.Else;

import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.io.IntWritable;

import java.io.IOException;

/**
 * 求最大值
 */
public class CourseReducer extends Reducer<Text, IntWritable, Text, IntWritable>
{
    public void reduce(Text key, Iterable<IntWritable> values, Context context)
        throws IOException, InterruptedException{
        int maxScore = 0;
        for (IntWritable val:values){
            maxScore = Math.max(maxScore, val.get());
        }
        context.write(key, new IntWritable(maxScore));
    }
}
